Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 15    Views: 160

miku
Aspiring developer
Profile
Posts: 405
Reg: Feb 20, 2014
zagorje ob savi
10,600
03/03/16 03:25 AM (8 years ago)

CP Stream plugin error in CP_streamsevice.java

In Android studio, file CP_streamsevice.java, line 418, which is: notification.setLatestEventInfo(mPlayerService, contentTitle, contentText, contentIntent); I got error: Error:(418, 13) error: cannot find symbol method setLatestEventInfo(Context,CharSequence,CharSequence,PendingIntent) Anybody got solution?
 
Dusko
Veteran developer
Profile
Posts: 998
Reg: Oct 13, 2012
Beograd
22,680
like
03/03/16 04:32 AM (8 years ago)
Did you contact the developer?
 
miku
Aspiring developer
Profile
Posts: 405
Reg: Feb 20, 2014
zagorje ob savi
10,600
like
03/03/16 04:40 AM (8 years ago)
I did, but no solution.
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
03/03/16 09:03 AM (8 years ago)
It might be a deprecated method.
 
miku
Aspiring developer
Profile
Posts: 405
Reg: Feb 20, 2014
zagorje ob savi
10,600
like
03/03/16 10:37 AM (8 years ago)
Maybe that's why it works only on Android 5.0 and lower, but not on 5.1 and higher version. Looks like I will have to wait if new version of plugin will be available.
 
Dusko
Veteran developer
Profile
Posts: 998
Reg: Oct 13, 2012
Beograd
22,680
like
03/03/16 10:43 AM (8 years ago)
Is the context properly defined? Here it would be variable mPlayerService. For BT, it should look like this: //can detect shaking? SensorManager sensorManager = (SensorManager)myappname_appDelegate.getContext().getSystemService(Context.SENSOR_SERVICE); Obviosly, change myappname and also obviously, the line above will detect shaking and not what you need in your app. However, try changing Context.SENSOR_SERVICE to what you need (type Context. and then press space to see what would AS offer you.) Maybe there is a constant that will be of help in your situation. Finally, if the method is really deprecated, the API makers must be offering a replacement -- search StackOverflow to see what it is.
 
miku
Aspiring developer
Profile
Posts: 405
Reg: Feb 20, 2014
zagorje ob savi
10,600
like
03/03/16 12:54 PM (8 years ago)
I forgot to tell you that in Eclipse plugin works fine for Android 5.0 and lower. In Android Studio does not.
 
Dusko
Veteran developer
Profile
Posts: 998
Reg: Oct 13, 2012
Beograd
22,680
like
03/03/16 01:22 PM (8 years ago)
The error then has nothing to do with the language, SDK version and the like. Try to suppress warnings and unwanted errors. Use something like this in the build.gradle (module) file: lintOptions { // set to true to turn off analysis progress reporting by lint quiet true // if true, stop the gradle build if errors are found abortOnError false // if true, only report errors ignoreWarnings true }
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
03/03/16 01:31 PM (8 years ago)
Quick search confirms it is a deprecated method. Remove it and see what happens
 
Dusko
Veteran developer
Profile
Posts: 998
Reg: Oct 13, 2012
Beograd
22,680
like
03/03/16 02:22 PM (8 years ago)
Yes it is a deprecated method. However, study this page, seems it has some good advice how to use the builder class which acts instead of the deprecated method. http://stackoverflow.com/questions/32345768/cannot-resolve-method-setlatesteventinfo Maybe the original developer can use similar code to produce a new version of the plugin? It also mentions a quick fix -- go to project -> properties and set android-target 21. What is your target, actually? Can you reproduce the build.gradle (module) file, here so we can see it?
 
miku
Aspiring developer
Profile
Posts: 405
Reg: Feb 20, 2014
zagorje ob savi
10,600
like
03/03/16 03:02 PM (8 years ago)
apply plugin: 'com.android.application' android { compileSdkVersion 23 buildToolsVersion "23.0.1" useLibrary 'org.apache.http.legacy' defaultConfig { applicationId "com.purple" minSdkVersion 14 targetSdkVersion 14 } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' } } } dependencies { compile files('libs/gcm.jar') compile 'com.google.android.gms:play-services:8.4.0' }
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
03/03/16 03:31 PM (8 years ago)
Just delete the line of code that's making it crash.there's no new method for it.
 
Dusko
Veteran developer
Profile
Posts: 998
Reg: Oct 13, 2012
Beograd
22,680
like
03/03/16 10:43 PM (8 years ago)
>compileSdkVersion 23 Try putting 14 instead of 23. I compile all my apps in that way and it checks out all the time. Specifically, setLatestEventInfo is deprecated only since M (API 23) so it should compile if you use earlier versions. Buzztouch should use 14 anyways. @CMCOFFEE >there's no new method for it. No, but the suggestion is to use NotificationCompat.Builder if you want to compile for API 23 and have it run on older versions too. The link to SO which I gave earlier contains full example how to replace the code.
 
miku
Aspiring developer
Profile
Posts: 405
Reg: Feb 20, 2014
zagorje ob savi
10,600
like
03/04/16 02:30 AM (8 years ago)
I put version 14, and to work I had to delete useLibrary 'org.apache.http.legacy' and set play-services to 6.5.87. Now it works in AS too. App still has limit to work on Android till version 5.1 , higher doesn't, but this may be solved by developer Cookup. I have enabled PN to yes, and receive message "There was problem communicating with Google Cloud Messaging system....." How can I disable this message?
 
Dusko
Veteran developer
Profile
Posts: 998
Reg: Oct 13, 2012
Beograd
22,680
like
03/04/16 02:43 AM (8 years ago)
Great, it works although not in a perfect way. As for the message you receive, perhaps CMCOFFEE could provide a good answer, he has more experience in push than I.
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
03/04/16 11:13 AM (8 years ago)
The notification method is easy to implement . It's actually in the new Android studio code for bt. I have it in one of my plugins. I'll look later
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.