Problems with Kontakt.io Beacon example - java

I have recently acquired a beacon from Kontakt.io
I followed the "Monitoring code example" from here: http://docs.kontakt.io/android-sdk/quickstart/#monitoring-code-sample
The Kontakt library is included (since other methods from the library is working), but the following line is giving me an error:
beaconManager.startMonitoring(Region.EVERYWHERE);
Error:
startMonitoring (java.util.Set<com.kontakt.sdk.android.device.Region>) in BeaconManager
cannot be applied to (com.kontakt.sdk.android.device.Region)
I have also tried creating a new region with the proximity uuid from the beacon:
static UUID uid = UUID.fromString("1DEFF9522D014664BB6088F065302B83");
private static final Region beacon = new Region(uid, 49668, 35726, null);
but this throws the same error.
I'm quite new to java and this might be a fairly simple question, but how do i resolve this?

If you check the changelog on their website you will see that there is new version of API. Clearly example is not updated. If you want to monitor Region.EVERYWHERE you can simply call beaconManager.startMonitoring() according to docs it should work.

Related

setContextPath() not found

I am trying to use the library Porcupine on Android. I have now downloaded a Rhino context file (.rhn) but can't find a way how to implement that file into my code.
The documentation says that I should use setContextPath() but this gives me the error:
Cannot resolve method 'setContextPath' in 'Builder'
That's how I tried it:
try {
porcupineManager = new PorcupineManager.Builder()
.setModelPath("porcupine_params_de.pv")
.setAccessKey(ACCESS_KEY)
.setKeywordPath("my_file_de_android_v2_0_0.ppn")
.setContextPath("my_file_de_android_v2_0_0.rhn");
.setSensitivity(0.7f).build(
getApplicationContext(),
porcupineManagerCallback);
porcupineManager.start();
}
...
I don't know what this method is good for since I can't even find it in its class.
So how can I use my .rhn file?
In the sample code from the link you provide, this method is called on different class:
PicovoiceManager picovoiceManager = new PicovoiceManager.Builder()
.setAccessKey("${ACCESS_KEY}")
.setKeywordPath("${KEYWORD_FILE_PATH}")
.setWakeWordCallback(wakeWordCallback)
.setContextPath("${CONTEXT_FILE_PATH}")
.setInferenceCallback(inferenceCallback)
.build(context);
you use PorcupineManager while sample code uses PicovoiceManager.

IabHelper no longer imports android.vending.billing.IInAppBillingService after upgrading to billingclient:billing:2.1.0

On upgrading the billingclient to 2.1.0:
implementation 'com.android.billingclient:billing:2.1.0'//from 2.0.1
I suddenly got a cannot resolve symbol 'vending' error in my IabHelper class:
I've had to go back to billing:2.0.1 to prevent this. I notice the link to Trivial Drive 2 from the inapp billing docs https://github.com/android/play-billing-samples/tree/master/TrivialDrive_v2 now gives a '404' can't find error. Digging through githup I see Trivail Drive 2 is archived, a new Kotlin example is now featured, 'TrivialDriveKotlin'.
Is the Trivial Drive 2 implementation of inapp billing no longer supported by the latest billing code? Is there an java version of the TrivialDriveKotlin code somewhere?
I could and will do a translation if there isn't, but there should be a java version of this up front. Getting the original trivial drive 2 code working and debugged in the first place was such a pain.
My solution ended up being not to bother with the Trivial Drive example at all. The current implementation is simple enough to implement directly starting here https://developer.android.com/google/play/billing/billing_library_overview.
The tricky part right from the start is this line:
billingClient = BillingClient.newBuilder(activity).setListener(this).build();
It's odd to see both 'activity' and 'this' used in the same line as you would typically substitute 'this' for 'activity'. You will get compile or runtime errors if these aren't set correctly. Better would be:
billingClient = BillingClient.newBuilder(this).setListener(new PurchasesUpdatedListener() {...}).build();
or
PurchasesUpdatedListener puchaselistener;
puchaselistener = new PurchasesUpdatedListener() {...}
billingClient = BillingClient.newBuilder(this).setListener(purchaselistener).build();

Can't set options to LibVLC

I have been trying to utilize the Android SDK from Maffen:
https://github.com/mrmaffen/vlc-android-sdk/ in order to stream RTSP.
So I found the following stack overflow thread:
vlc-android-sdk - cannot view RTSP live video
Which has a number of answers of how to do this.
However, the problem I am having is that when I try to set the options for LibVLC it will not allow me to do so.
For example:
ArrayList<String> options = new ArrayList<String>();
options.add("--no-drop-late-frames");
options.add("--no-skip-frames");
options.add("--rtsp-tcp");
options.add("-vvv");
videoVlc = new LibVLC(options)
When I try to run this I get the following error message in Android Studio:
"error: incompatible types: ArrayList cannot be converted to Context"
Also if I hover over the "LibVLC(options)" section of the code it comes up with the following message:
"LibVLC (android.content.Context) in LibVLC cannot be applied to (java.util.ArrayList)
I'm no Java expert, so perhaps this is an easy fix but I have been trying different sample codes from around the internet all day and every single one sets those options and I can't do it.
Any help would be much appreciated. Thank you!
EDIT:
This problem was solved using the following:
videoVlc = new LibVLC(this, options);
I had simply forgot about including the context part of the LibVLC.
I forgot to go back and edit this once I had arrived at a solution.
maffen vlc android sdk. the constructor LibVLC takes two params. context and options. option can be null. and options should be the second one. the older version may only takes one param option

Chunked uploading of media with Twitter4J

I am trying to upload a video on Twitter. I am using the following code:
private UploadedMedia uploadMediaChunkedInit(long size) throws TwitterException {
return new UploadedMedia(post(
conf.getUploadBaseURL() + "media/upload.json",
new HttpParameter[] { new HttpParameter("command", CHUNKED_INIT),
new HttpParameter("media_type", "video/mp4"),
new HttpParameter("total_bytes", size) }).asJSONObject());
}
Where I am getting following error:
Method post is not defined
I got this code from here:
https://github.com/yusuke/twitter4j/pull/226/commits/73b43c1ae4511d3712118f61f983bcbca4ef0c59
Those methods are private implementation details/utilities of the TwitterImpl class.
See lines 1844-1860 and lines 1862-1878
(notice they are private).
You are approaching this incorrectly. Never should you have to call an internal implementation detail. Instead, use the public API of Twitter4J. You should use the uploadMediaChunked method instead. There is currently no javadoc I can link you to (since it's a relatively new feature).
I also see that this feature is not yet released. For now, you can build Twitter4J yourself and then use its public API (instead of copying source code into your own project).

How to increment/update a issue custom Value in JIRA, based on its previous value?

Hello I have a lot of automatic issue creation and commenting in JIRA. And wanted to add to the issue a customField named "Number of automatic updates" that increments everytime an issues is commented. The tipical solution for this is using the number of comments but that is not possible in because the comments are limited programatically to 20. So in this case I would always have at max 20.
Is there any straightforward method that makes it possible to do so?
I'm trying this approach but it keeps giving me exception and errors related to the CustomField Object:
MutableIssue issue = IM.getIssueObject(alreadyReportedIssueId);
private static final String COMMENTNUMBER_CUSTOMFIELD_ID = "commentnumber-customfield-id";
private static final CustomField customFieldObject = CustomFieldManager.getCustomFieldObjectByName(COMMENTNUMBER_CUSTOMFIELD_ID);
issue.setCustomFieldValue(COMMENTNUMBER_CUSTOMFIELD_ID, (Integer.parseInt(customFieldObject.getValue(issue))++));
PS: The version of JIRA I'm using is: version 3.13.5
This seems trivial with the Jira REST API?
https://developer.atlassian.com/jiradev/jira-apis/jira-rest-apis/jira-rest-api-tutorials/updating-an-issue-via-the-jira-rest-apis

Categories

Resources