yamill/react-native-orientation

AddOrientationListener not working for in android

AmmiWang opened this issue · 3 comments

AddOrientationListener not working for in android

I believe my configuration is all right. But it's no working!

Could you share the error message?

I had the same problem in android with react native 0.60.4

After adding below codes in MainActivity.java, it worked fine. (implementing onConfigurationChanged):

import android.content.Intent; // <--- import
    import android.content.res.Configuration; // <--- import

    public class MainActivity extends ReactActivity {
      ......
      @Override
      public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        Intent intent = new Intent("onConfigurationChanged");
        intent.putExtra("newConfig", newConfig);
        this.sendBroadcast(intent);
    }

      ......

}

hope this help you. :)