小编sip*_*rus的帖子

什么是GCM注册ID?

您好我想将gcm添加到我的应用程序中.我的申请是一个新闻申请.用户可在注册后查看新闻.应用程序询问用户兴趣(经济,体育,汽车等)并保存它们.我想通过php和mysql发送消息给用户.我必须决定向哪些用户发送哪些新闻.所以我需要注册ID.

是android设备号吗?或Android设备谷歌帐户和Android设备号码的组合?
或Android设备谷歌帐户和Android设备号和我的应用程序用户ID的组合?

Android设备ID = a => GCM RegID =
Android设备ID = a,Google帐户ID = b => GCM RegID = ab
Android设备ID = a,Google帐户ID = b,应用x用户ID = c => GCM RegID = ABC

如果x用户从应用程序注销并且用户登录同一设备,GCM RegId会更改吗?如果它没有改变并且我将经济新闻推送给用户(对经济不感兴趣),设备将向错误的用户显示错误的通知.那么什么是GCM注册ID?

android push-notification google-cloud-messaging

10
推荐指数
2
解决办法
2万
查看次数

startActivityForResult usage for multiple activities

i use startActivityForResult for two activities like this

Activity A -> startActivityForResult(ActivityB,0) -> Activity B -> setresult(10); finish(); -> Activity A -> if(result==10) {dofunction(); }
Run Code Online (Sandbox Code Playgroud)

but i must use this logic for 4 or more activities.

Activity A -> startActivityForResult(ActivityB,0) -> Activity B -> finish(); -> Activity C -> finish(); -> Activity D -> setresult(10); finish(); -> Activity A -> if(result==10) {dofunction(); }
Run Code Online (Sandbox Code Playgroud)

but this does not work.

android

9
推荐指数
1
解决办法
5334
查看次数

在新设备上挑选照片时Android应用程序崩溃

在我的应用程序中,用户从库中选择图片并上传.在许多设备上,我的代码工作得很完美,但在新设备上(等:samsung S5,LG G2,Samsung S4)应用程序在选择照片时崩溃.我将应用程序上传到Google Play商店并下载这些设备,然后在应用崩溃时将已发送的报告发送到Google Play.这是我的选择图片和调整代码大小.

Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "Complete action using"), 1); 

public Bitmap getResizedBitmap(Bitmap bm, int newHeight, int newWidth) {
    int width = bm.getWidth();
    int height = bm.getHeight();
    float scaleWidth = ((float) newWidth) / width;
    float scaleHeight = ((float) newHeight) / height;
    // create a matrix for the manipulation
    Matrix matrix = new Matrix();
    // resize the bit map
    matrix.postScale(scaleHeight, scaleHeight);
    // recreate the new Bitmap
    Bitmap resizedBitmap = Bitmap.createBitmap(bm, 0, 0, width, …
Run Code Online (Sandbox Code Playgroud)

crash android

5
推荐指数
1
解决办法
7326
查看次数

为特定页面设置浏览器打印机

我正在编写一个基于Web的软件.我打印条形码.

PC上有2台打印机,因此用户必须始终选择用于打印条形码的条形码打印机和用于打印报告的激光打印机.

有没有办法为页面设置打印机.(来自浏览器设置或通过javascript)

例如:

www.example.com/barcodeprint.php ---->条码打印机

www.example.com/reportprint.php ---->激光打印机

谢谢

javascript browser printing

5
推荐指数
2
解决办法
1073
查看次数