当用户点击推送通知时,以下代码用作我的处理程序。代码运行正常,launchURL准确记录在我的日志中。但是,作为下一步,我想将用户引导至名为ViewPushLink. 我试图遵循在其他地方找到的类似说明,但作为一个新手,我希望得到一些具体的帮助。
class ExampleNotificationOpenedHandler implements OneSignal.NotificationOpenedHandler {
public static String launchURL;
@Override
public void notificationOpened(OSNotificationOpenResult result) {
OSNotificationAction.ActionType actionType = result.action.type;
JSONObject data = result.notification.payload.additionalData;
if (data != null) {
launchURL = data.optString("launchURL");
if (launchURL != null) {
Log.i("OneSignalExample", "launchURL value: " + launchURL);
}
}
}
}
编辑:ExampleNotificationOpenedHandler从我的主要活动中调用,如下所示:
public class MainActivity extends AppCompatActivity {
private ProgressDialog progress;
public static boolean isNetworkStatusAvailable (Context context) {
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
if (connectivityManager != null)
{
NetworkInfo netInfos = connectivityManager.getActiveNetworkInfo();
if(netInfos != null)
if(netInfos.isConnected())
return true;
}
return false;
}
倚天杖
catspeake
相关分类