Android : Not able to sync data between applications above Oreo + devices
up vote
1
down vote
favorite
I am stuck on sync real time data between 2 app only in Oreo+ devices, Like if different user login to the app then it should be immediately effect in other app and It should also change in other app.(e.g. Facebook and Facebook Messenger. If you logout from Facebook, it will automatically logout from FB Messenger or If you log into Facebook then it will automatically logged into FB Messenger and vice versa) I created broadcast receiver in both app and if login changes from one app then send broadcast to other app where it will do rest of work.
I have googled on it and I found some ways.
I have read this document
https://developer.android.com/about/versions/oreo/background
- We have published differently signed APKs so not able to provide same signature permission in receiver.
Already went through this links
Broadcast receiver not working in oreo
Oreo: Broadcast receiver Not working
Broadcast receiver registered in manifest not getting called in Android Oreo
Receiver stopped receiving in Oreo
Thought to implement this ways but..
1) Create foreground service and register receiver into it.
- As this way, I need one notification which is required to run foreground service. and I can't do that.I can't show unnecessary notification.
2) Scheduled job:
- I can't use it as I need to run service all time in background.
What I have tried so far:
1) Register receiver in Application class : This is not working after application is killed because context has been killed.
2) Registering receiver in FireBase Notification service, but it's only initialize when notification arrives.
Code:
Registering receiver in Application class
ASampleActionReceiver mASampleActionReceiver = new ASampleActionReceiver();
IntentFilter filterAction = new IntentFilter();
filterAction.addAction("com.sample.example.receiver.operation");
registerReceiver(mASampleActionReceiver, filterAction);
In Manifest
<receiver android:name=".receiver.ASampleActionReceiver">
<intent-filter>
<action android:name="com.sample.example.receiver.operation" />
</intent-filter>
</receiver>
Intent service will start by receiver
<service
android:name="com.sample.example.services.SampleOperationService"
android:enabled="true"
android:exported="false" />
And a Receiver ASampleActionReceiver.java
public class ASampleActionReceiver extends BroadcastReceiver {
Context mContext;
@Override
public void onReceive(Context context, Intent intent) {
mContext = context;
AdoddleLog.d("LOG", intent.getExtras().getString("loginData"));
Intent mIntent = new Intent(mContext, SampleOperationService.class);
mIntent.putExtras(intent);
mContext.startService(mIntent);
}
}
can some one please suggest better solution?
android broadcastreceiver android-service android-8.0-oreo android-intentservice
add a comment |
up vote
1
down vote
favorite
I am stuck on sync real time data between 2 app only in Oreo+ devices, Like if different user login to the app then it should be immediately effect in other app and It should also change in other app.(e.g. Facebook and Facebook Messenger. If you logout from Facebook, it will automatically logout from FB Messenger or If you log into Facebook then it will automatically logged into FB Messenger and vice versa) I created broadcast receiver in both app and if login changes from one app then send broadcast to other app where it will do rest of work.
I have googled on it and I found some ways.
I have read this document
https://developer.android.com/about/versions/oreo/background
- We have published differently signed APKs so not able to provide same signature permission in receiver.
Already went through this links
Broadcast receiver not working in oreo
Oreo: Broadcast receiver Not working
Broadcast receiver registered in manifest not getting called in Android Oreo
Receiver stopped receiving in Oreo
Thought to implement this ways but..
1) Create foreground service and register receiver into it.
- As this way, I need one notification which is required to run foreground service. and I can't do that.I can't show unnecessary notification.
2) Scheduled job:
- I can't use it as I need to run service all time in background.
What I have tried so far:
1) Register receiver in Application class : This is not working after application is killed because context has been killed.
2) Registering receiver in FireBase Notification service, but it's only initialize when notification arrives.
Code:
Registering receiver in Application class
ASampleActionReceiver mASampleActionReceiver = new ASampleActionReceiver();
IntentFilter filterAction = new IntentFilter();
filterAction.addAction("com.sample.example.receiver.operation");
registerReceiver(mASampleActionReceiver, filterAction);
In Manifest
<receiver android:name=".receiver.ASampleActionReceiver">
<intent-filter>
<action android:name="com.sample.example.receiver.operation" />
</intent-filter>
</receiver>
Intent service will start by receiver
<service
android:name="com.sample.example.services.SampleOperationService"
android:enabled="true"
android:exported="false" />
And a Receiver ASampleActionReceiver.java
public class ASampleActionReceiver extends BroadcastReceiver {
Context mContext;
@Override
public void onReceive(Context context, Intent intent) {
mContext = context;
AdoddleLog.d("LOG", intent.getExtras().getString("loginData"));
Intent mIntent = new Intent(mContext, SampleOperationService.class);
mIntent.putExtras(intent);
mContext.startService(mIntent);
}
}
can some one please suggest better solution?
android broadcastreceiver android-service android-8.0-oreo android-intentservice
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I am stuck on sync real time data between 2 app only in Oreo+ devices, Like if different user login to the app then it should be immediately effect in other app and It should also change in other app.(e.g. Facebook and Facebook Messenger. If you logout from Facebook, it will automatically logout from FB Messenger or If you log into Facebook then it will automatically logged into FB Messenger and vice versa) I created broadcast receiver in both app and if login changes from one app then send broadcast to other app where it will do rest of work.
I have googled on it and I found some ways.
I have read this document
https://developer.android.com/about/versions/oreo/background
- We have published differently signed APKs so not able to provide same signature permission in receiver.
Already went through this links
Broadcast receiver not working in oreo
Oreo: Broadcast receiver Not working
Broadcast receiver registered in manifest not getting called in Android Oreo
Receiver stopped receiving in Oreo
Thought to implement this ways but..
1) Create foreground service and register receiver into it.
- As this way, I need one notification which is required to run foreground service. and I can't do that.I can't show unnecessary notification.
2) Scheduled job:
- I can't use it as I need to run service all time in background.
What I have tried so far:
1) Register receiver in Application class : This is not working after application is killed because context has been killed.
2) Registering receiver in FireBase Notification service, but it's only initialize when notification arrives.
Code:
Registering receiver in Application class
ASampleActionReceiver mASampleActionReceiver = new ASampleActionReceiver();
IntentFilter filterAction = new IntentFilter();
filterAction.addAction("com.sample.example.receiver.operation");
registerReceiver(mASampleActionReceiver, filterAction);
In Manifest
<receiver android:name=".receiver.ASampleActionReceiver">
<intent-filter>
<action android:name="com.sample.example.receiver.operation" />
</intent-filter>
</receiver>
Intent service will start by receiver
<service
android:name="com.sample.example.services.SampleOperationService"
android:enabled="true"
android:exported="false" />
And a Receiver ASampleActionReceiver.java
public class ASampleActionReceiver extends BroadcastReceiver {
Context mContext;
@Override
public void onReceive(Context context, Intent intent) {
mContext = context;
AdoddleLog.d("LOG", intent.getExtras().getString("loginData"));
Intent mIntent = new Intent(mContext, SampleOperationService.class);
mIntent.putExtras(intent);
mContext.startService(mIntent);
}
}
can some one please suggest better solution?
android broadcastreceiver android-service android-8.0-oreo android-intentservice
I am stuck on sync real time data between 2 app only in Oreo+ devices, Like if different user login to the app then it should be immediately effect in other app and It should also change in other app.(e.g. Facebook and Facebook Messenger. If you logout from Facebook, it will automatically logout from FB Messenger or If you log into Facebook then it will automatically logged into FB Messenger and vice versa) I created broadcast receiver in both app and if login changes from one app then send broadcast to other app where it will do rest of work.
I have googled on it and I found some ways.
I have read this document
https://developer.android.com/about/versions/oreo/background
- We have published differently signed APKs so not able to provide same signature permission in receiver.
Already went through this links
Broadcast receiver not working in oreo
Oreo: Broadcast receiver Not working
Broadcast receiver registered in manifest not getting called in Android Oreo
Receiver stopped receiving in Oreo
Thought to implement this ways but..
1) Create foreground service and register receiver into it.
- As this way, I need one notification which is required to run foreground service. and I can't do that.I can't show unnecessary notification.
2) Scheduled job:
- I can't use it as I need to run service all time in background.
What I have tried so far:
1) Register receiver in Application class : This is not working after application is killed because context has been killed.
2) Registering receiver in FireBase Notification service, but it's only initialize when notification arrives.
Code:
Registering receiver in Application class
ASampleActionReceiver mASampleActionReceiver = new ASampleActionReceiver();
IntentFilter filterAction = new IntentFilter();
filterAction.addAction("com.sample.example.receiver.operation");
registerReceiver(mASampleActionReceiver, filterAction);
In Manifest
<receiver android:name=".receiver.ASampleActionReceiver">
<intent-filter>
<action android:name="com.sample.example.receiver.operation" />
</intent-filter>
</receiver>
Intent service will start by receiver
<service
android:name="com.sample.example.services.SampleOperationService"
android:enabled="true"
android:exported="false" />
And a Receiver ASampleActionReceiver.java
public class ASampleActionReceiver extends BroadcastReceiver {
Context mContext;
@Override
public void onReceive(Context context, Intent intent) {
mContext = context;
AdoddleLog.d("LOG", intent.getExtras().getString("loginData"));
Intent mIntent = new Intent(mContext, SampleOperationService.class);
mIntent.putExtras(intent);
mContext.startService(mIntent);
}
}
can some one please suggest better solution?
android broadcastreceiver android-service android-8.0-oreo android-intentservice
android broadcastreceiver android-service android-8.0-oreo android-intentservice
edited 13 hours ago
asked 16 hours ago
Mayur Raval
1,96052553
1,96052553
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53370019%2fandroid-not-able-to-sync-data-between-applications-above-oreo-devices%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown