I can not receive intent when I use this action
<action android:name="com.clover.sdk.customer.intent.action.CUSTOMER_UPDATE"/>
I can not receive intent when I use this action
<action android:name="com.clover.sdk.customer.intent.action.CUSTOMER_UPDATE"/>
Hi @yc,
I'm receiving Intents fine with this broadcast. Please note the documentation for CustomerConnector.getCustomer() and note that the Intent is only conditionally fired:
This call will return immediately with the local version of the customer if one exists on the device, it will then contact the server to check for an updated version. If a new version exists a
{com.clover.sdk.v1.customer.CustomerIntent#ACTION_CUSTOMER_UPDATE} broadcast will be sent.
In your AndroidManifest.xml
, declare the BroadcastReceiver and specify the com.clover.sdk.customer.intent.action.CUSTOMER_UPDATE
broadcast action that the receiver subscribes to:
<receiver android:name=".MyBroadcastReceiver" android:exported="true">
<intent-filter>
<action android:name="com.clover.sdk.customer.intent.action.CUSTOMER_UPDATE"/>
</intent-filter>
</receiver>
Then implement the Java:
public class MyBroadcastReceiver extends BroadcastReceiver {
private static final String TAG = "MyBroadcastReceiver";
@Override
public void onReceive(Context context, Intent intent) {
StringBuilder sb = new StringBuilder();
sb.append("Action: " + intent.getAction() + "\n");
sb.append("URI: " + intent.toUri(Intent.URI_INTENT_SCHEME).toString() + "\n");
String log = sb.toString();
Log.d(TAG, log);
Toast.makeText(context, log, Toast.LENGTH_LONG).show();
}
}
Thanks Mark.
I thought that the broadcast is sent if a any change made at the server. So if I want to receive the broadcast I have to use CustomerConnector.getCustomer() ?
No one has followed this question yet.