### Initialize and Start Blippar SDK (Objective-C) Source: https://github.com/blippar/blippar-ar-sdk/blob/master/guides/ios/README.md Sets up the Blippar SDK by getting the shared instance, adding a delegate, and starting the detection process within the `viewDidLoad` and `onBlipparInitialiseSuccess` methods. ```objectivec BlipparSDK* blipparSDK = [BlipparSDK sharedInstance]; [blipparSDK addSDKDelegate:self]; - (void) onBlipparInitialiseSuccess { [super onBlipparInitialiseSuccess]; BlipparSDK* blipparSDK = [BlipparSDK sharedInstance]; [blipparSDK startDetection]; //Camera view screenshots will only be sent for recognition after this method is called } ``` -------------------------------- ### Initialize and Start Blippar SDK (Swift) Source: https://github.com/blippar/blippar-ar-sdk/blob/master/guides/ios/README.md Initializes the Blippar SDK in Swift by obtaining the shared instance, registering a delegate, and initiating camera detection upon successful initialization. ```swift let sdk = BlipparSDK.sharedInstance() sdk.addSDKDelegate(self) override func onBlipparInitialiseSuccess() { super.onBlipparInitialiseSuccess() let sdk = BlipparSDK.sharedInstance() sdk.startDetection() } ``` -------------------------------- ### Initialize and Manage Blippar SDK Listener (Java) Source: https://github.com/blippar/blippar-ar-sdk/blob/master/guides/android/README.md This Java code demonstrates how to set up an SDK listener to manage the Blippar SDK lifecycle. It includes overriding callbacks for initialization success and error, starting blipp detection, and removing the listener in the onDestroy method to prevent memory leaks. ```java private final BlipparSDK.BlipparSDKListener blipparSDKListener = new BlipparSDK.BlipparSDKListener() { @Override public void onInitialiseSuccess() { final BlipparSDK sdk = Blippar.getSDK(); // after the SDK is initialised, start detection and rendering // You can add other kinds of detectionTypes with the other startDetection variant sdk.startDetection(); } @Override public void onInitialiseError() { } @Override public void onShutdown() { } }; // In your Activity class: Blippar.getSDK().addSDKListener(blipparSDKListener); protected void onDestroy() { super.onDestroy(); // when destroying the activity, remove the lifecycle observer Blippar.getSDK().removeSDKListener(blipparSDKListener); } ``` -------------------------------- ### Initialize and Manage Blippar SDK Listener (Kotlin) Source: https://github.com/blippar/blippar-ar-sdk/blob/master/guides/android/README.md This Kotlin code illustrates setting up an SDK listener for the Blippar SDK. It covers handling initialization success and errors, initiating blipp detection, and ensuring the listener is removed during the activity's destruction to avoid resource issues. ```kotlin private var mBlipparSDKListener = object : BlipparSDK.BlipparSDKListener { override fun onInitialiseSuccess() { // Start detection with just markers // You can add other kinds of detectionTypes with the other startDetection variant Blippar.getSDK().startDetection() } override fun onInitialiseError(error: InitialisationError) { Toast.makeText(this@MainActivity, "Unable to initialise SDK with error: " + error.toString(), Toast.LENGTH_LONG).show() Log.e(LogTag, "Unable to initialise SDK with error: " + error.toString()) } override fun onShutdown() { // Cleanup and remove the listener now Blippar.getSDK().removeSDKListener(this) } } // In your Activity class: Blippar.getSDK().addSDKListener(mBlipparSDKListener) override fun onDestroy() { super.onDestroy() // Remove our listeners Blippar.getSDK().removeSDKListener(mBlipparSDKListener) } ``` -------------------------------- ### Start Telnet Console Client - iOS Objective-C Source: https://github.com/blippar/blippar-ar-sdk/blob/master/guides/debugging/debugging-telnet-console.md Starts the Telnet console client in a custom SDK application using Objective-C. This method is part of the Blippar SDK and is used for remote debugging. ```objectivec BOOL didStart = [BlipparSDK sharedInstance].debugConsole start]; ``` -------------------------------- ### Initialize Blippar SDK in AppDelegate (Swift) Source: https://github.com/blippar/blippar-ar-sdk/blob/master/guides/ios/README.md This snippet shows how to initialize the Blippar SDK in your AppDelegate.swift file using Swift 3. It involves setting the SDK key, getting the shared instance, adding the delegate, and calling the initialise method. Ensure an Objective-C bridging header is set up if needed. ```swift // In AppDelegate.swift: // class AppDelegate: UIResponder, UIApplicationDelegate, BlipparSDKDelegate func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { BlipparSDK.setKey(appKey) let sdk = BlipparSDK.sharedInstance() sdk.addSDKDelegate(self) sdk.initialise() // ... other setup code ... return true } func onBlipparInitialiseSuccess() { // SDK initialized successfully } func onBlipparInitialiseError(_ error: BlipparSDKError) { // Handle initialization error print(error.description) } func onBlipparShutdown() { // SDK shutdown } ``` -------------------------------- ### Start Telnet Console Client - Android Java Source: https://github.com/blippar/blippar-ar-sdk/blob/master/guides/debugging/debugging-telnet-console.md Starts the Telnet console client in a custom SDK application using Java. This method is part of the Blippar SDK and is used for remote debugging. ```java boolean didStart = Blippar.getSDK().getDebugConsole().start(); ``` -------------------------------- ### Extract iOS Bundle ID from iTunes Lookup API Source: https://github.com/blippar/blippar-ar-sdk/blob/master/faq.md This example demonstrates how to construct a URL for the iTunes Lookup API to retrieve app information, including the 'bundleId'. This is useful for finding the iOS App ID when you don't have direct access to the source code. ```http https://itunes.apple.com/lookup?id=361309726 ``` -------------------------------- ### JSON Configuration for Blipps Source: https://context7.com/blippar/blippar-ar-sdk/llms.txt This section explains how to associate JSON configuration data with blipps before launch. The blipp receives this data on startup, enabling template-based AR experiences that adapt based on app-provided data. Examples show how to set configuration in Android and iOS, and how to read it within a Blippbuilder script. ```APIDOC ## JSON Configuration for Blipps Associates JSON configuration data with blipps before launch. The blipp receives this data on startup, enabling template-based AR experiences that adapt based on app-provided data. ### Setting Configuration in Host Application #### Android ##### Description Use `EntityDescriptorFactory` to create a descriptor for the target blipp and then use `Blippar.getSDK().setConfigJSONForEntity()` to associate JSON configuration. ##### Method `Blippar.getSDK().setConfigJSONForEntity(EntityDescriptor descriptor, String configJson)` ##### Parameters - **descriptor** (EntityDescriptor) - Required - Describes the target entity (e.g., blipp address). - **configJson** (string) - Required - A JSON string containing the configuration data. ##### Request Example ```java String blippAddress = "abcdefgh"; EntityDescriptor descriptor = EntityDescriptorFactory.createFromAddress(blippAddress); // JSON configuration to pass to blipp JSONObject config = new JSONObject(); config.put("videoUrl", "https://example.com/video.mp4"); config.put("productName", "Amazing Widget"); config.put("showPrice", true); Blippar.getSDK().setConfigJSONForEntity(descriptor, config.toString()); ``` #### iOS (Objective-C) ##### Description Create an `BlipparSDKEntityDescriptor` and use `[[BlipparSDK sharedInstance] setConfigJSONForEntity:descriptor jsonData:]` to associate JSON configuration. ##### Method `- (void)setConfigJSONForEntity:(BlipparSDKEntityDescriptor *)descriptor jsonData:(id)jsonData;` ##### Parameters - **descriptor** (BlipparSDKEntityDescriptor) - Required - Describes the target entity (e.g., blipp address, marker ID). - **jsonData** (NSDictionary or NSString) - Required - A dictionary or JSON string containing the configuration data. ##### Request Example ```objectivec NSString* blippAddress = @""; // Empty = any blipp NSString* markerId = @"12345"; BlipparSDKEntityDescriptor *descriptor = [BlipparSDKEntityDescriptor entityWithAddress:blippAddress andMarkerID:markerId]; NSDictionary *config = @{ @"videoUrl": @"https://example.com/video.mp4", @"productName": @"Amazing Widget", @"showPrice": @YES }; [[BlipparSDK sharedInstance] setConfigJSONForEntity:descriptor jsonData:config]; ``` ### Reading Configuration in Blippbuilder Script #### Description Access the configuration data passed from the host application via the `createJson` parameter in the `scene.onCreate` function. #### Code Example ```javascript scene.onCreate = function(createJson) { var json = JSON.parse(createJson); if (json.hasOwnProperty("associatedData")) { var config = JSON.parse(json["associatedData"]); // Use configuration to customize blipp if (config.videoUrl) { loadVideo(config.videoUrl); } if (config.productName) { setProductLabel(config.productName); } } }; ``` ``` -------------------------------- ### ARCore Packaging Options for Build Conflicts Source: https://github.com/blippar/blippar-ar-sdk/blob/master/guides/android/README.md Configures packaging options in the app's `build.gradle` file to resolve conflicts with ARCore native libraries. This is necessary when both the app and the Blippar SDK include ARCore, preventing duplicate native library errors during the build process. ```gradle android { packagingOptions { pickFirst 'lib/arm64-v8a/libarcore_sdk_c.so' pickFirst 'lib/armeabi-v7a/libarcore_sdk_c.so' pickFirst 'lib/x86_64/libarcore_sdk_c.so' pickFirst 'lib/x86/libarcore_sdk_c.so' } } ``` -------------------------------- ### Embed License Key and Initialize Blippar SDK (Java) Source: https://github.com/blippar/blippar-ar-sdk/blob/master/guides/android/README.md This snippet demonstrates how to embed your Blippar license key and initialize the SDK within your Android application. Ensure you replace 'YOUR_LICENSE_KEY' with your actual key obtained from Blippar. This is a crucial step for the SDK to function correctly. ```java import com.blippar.sdk.BlipparSDK; // ... inside your Activity or Application class public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // ... other setup String licenseKey = "YOUR_LICENSE_KEY"; // Replace with your actual license key BlipparSDK.initialize(this, licenseKey); // ... rest of your onCreate method } ``` -------------------------------- ### Initialize Blippar SDK in Application Class (Java/Kotlin) Source: https://github.com/blippar/blippar-ar-sdk/blob/master/guides/android/README.md Demonstrates how to initialize and register the Blippar AR SDK within your Android application's `Application` class. This involves importing the `Blippar` class and calling `setApplication` and `setKey` methods in the `onCreate` callback. Remember to keep your license key secure. ```java import com.blippar.ar.android.sdk.Blippar; // ... inside your Application class @Override protected void onCreate() { super.onCreate(); Blippar.setApplication(this); Blippar.setKey("enter your license key here"); } ``` ```kotlin import com.blippar.ar.android.sdk.Blippar // ... inside your Application class override fun onCreate() { super.onCreate() Blippar.setApplication(this) Blippar.setKey("enter your license key here") } ``` -------------------------------- ### Initialize Blippar SDK - Android (Java) Source: https://context7.com/blippar/blippar-ar-sdk/llms.txt Initializes the Blippar SDK within an Android application's Application class. Requires a valid license key to be set before any AR functionality can be utilized. This setup is crucial for the SDK to operate correctly. ```java package com.blippar.demo.java; import android.app.Application; import com.blippar.ar.android.sdk.Blippar; public class App extends Application { @Override public void onCreate() { super.onCreate(); // Register the application with the SDK Blippar.setApplication(this); // Set your license key (keep this secure, don't store in plaintext files) Blippar.setKey("your_license_key_here"); } } ``` -------------------------------- ### Implement Blipp State Listener in Kotlin Source: https://github.com/blippar/blippar-ar-sdk/blob/master/guides/android/README.md This snippet demonstrates how to implement the BlippStateListener interface in Kotlin to handle various blipp lifecycle events such as loading, running, errors, and closing. It shows how to create the listener object and register it with the Blippar SDK. Remember to unregister the listener when it's no longer needed. ```kotlin private val mBlippStateListener = object : BlippStateListener { override fun onBlippLoading(blippEngineContext: BlippContext) { // Blipp has started loading } override fun onBlippWaitingForTrackingLock(context: BlippContext) { // Blipp is waiting for the tracker to lock onto the target before loading } override fun onBlippLoadingProgress(context: BlippContext, i: Int) { // Blipp is loading with the visible progress spinner } override fun onBlippError(context: BlippContext, blipparSDKBlippErrorType: BlipparSDKBlippErrorType) { // Blipp has failed to trigger with the given error } override fun onBlippRunning(context: BlippContext, runningState: BlippRunningState) { // Blipp is running in the given state } override fun onBlippEvent(context: BlippContext, eventName: String, jsonObject: JSONObject) { // Blipp to app events will come through here. This app is not interested in these // Return true to indicate that the app has handled the event return false; } override fun onBlippClosing(context: BlippContext) { // Blipp has begun closing } override fun onBlippClosed(context: BlippContext) { // Blipp is closed } } // Register with the SDK Blippar.getSDK().addBlippStateListener(mBlippStateListener) // Make sure you remove the listener e.g. in `onDestroy()` ``` -------------------------------- ### Blipp-to-App Communication Source: https://context7.com/blippar/blippar-ar-sdk/llms.txt This section details how a running blipp can send events back to the host application. The host application can register listeners to receive these events and respond accordingly. Examples are provided for sending simple events and events with JSON data from Blippbuilder scripts, and for receiving these events in Android and iOS applications. ```APIDOC ## Blipp-to-App Communication Allows a running blipp to send events back to the host application. The app receives these events through registered listeners and can respond accordingly. ### Sending Events from Blippbuilder Script #### Method `blipp.getApp().sendAppEvent(eventName, jsonData)` #### Parameters - **eventName** (string) - Required - The name of the event to send. - **jsonData** (string) - Optional - A JSON string representing the data associated with the event. #### Request Example (Simple Event) ```javascript blipp.getApp().sendAppEvent("buttonClicked"); ``` #### Request Example (Event with JSON Data) ```javascript blipp.getApp().sendAppEvent("purchase", JSON.stringify({ 'productId': 'SKU123', 'quantity': 2, 'price': 29.99, 'currency': 'USD' })); ``` ### Receiving Events in Host Application #### Android ##### Description Implement the `BlippStateListener` interface to receive events from blipps. ##### Code Example ```java private final BlippStateListener blippListener = new BlippStateListener() { @Override public boolean onBlippEvent(BlippContext context, String eventName, JSONObject jsonData) { switch (eventName) { case "buttonClicked": // Handle simple event showToast("Button clicked in AR!"); return true; case "purchase": // Handle event with data String productId = jsonData.optString("productId"); double price = jsonData.optDouble("price"); processPurchase(productId, price); return true; default: return false; // Event not handled } } // ... other required overrides }; ``` #### iOS (Objective-C) ##### Description Implement the `onBlippEvent` method in your delegate to receive events from blipps. ##### Code Example ```objectivec - (BOOL)onBlippEvent:(BlipparSDKBlippContext *)context eventName:(NSString *)name jsonData:(id)jsonData { if ([name isEqualToString:@"buttonClicked"]) { [self showAlert:@"Button clicked in AR!"]; return YES; } if ([name isEqualToString:@"purchase"]) { NSDictionary* data = (NSDictionary*)jsonData; NSString* productId = data[@"productId"]; NSNumber* price = data[@"price"]; [self processPurchaseWithId:productId price:price]; return YES; } return NO; // Event not handled } ``` ``` -------------------------------- ### Android Gradle Dependencies for Blippar SDK (Kotlin) Source: https://github.com/blippar/blippar-ar-sdk/blob/master/guides/android/README.md Specifies the Gradle dependencies required for the Blippar AR SDK when using Kotlin. This includes Kotlin standard library, Android support libraries, Picasso for image loading, Google Play Services for vision and location, and ARCore for augmented reality features. Ensure these versions match your project's requirements. ```gradle implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion" // For SDK user interface implementation "com.android.support:support-core-utils:${androidSupportLibVersion}" implementation "com.android.support:design:${androidSupportLibVersion}" implementation "com.android.support:preference-v14:${androidSupportLibVersion}" // For loading images from Photos/gallery and knowing the correct orientation of the asset implementation "com.android.support:exifinterface:${androidSupportLibVersion}" // For local PDF rendering implementation "com.android.support:recyclerview-v7:${androidSupportLibVersion}" implementation "com.squareup.picasso:picasso:${picassoVersion}" // Face detection/tracking implementation "com.google.android.gms:play-services-vision:${googlePlayServicesLibVersion}" // Required by Location Services implementation "com.google.android.gms:play-services-location:${googlePlayServicesLibVersion}" // Required for ARCore implementation "com.google.ar:core:${arcoreLibVersion}" ``` -------------------------------- ### Initialize Blippar SDK in AppDelegate (Objective-C) Source: https://github.com/blippar/blippar-ar-sdk/blob/master/guides/ios/README.md This snippet demonstrates how to initialize the Blippar SDK within your AppDelegate.m file in Objective-C. It requires your SDK license key and adds the AppDelegate as an SDK delegate. The initialization happens in the background, and success or failure is communicated via delegate methods. ```objective-c #import // In AppDelegate.h: // @interface AppDelegate : UIResponder // In AppDelegate.m: - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Initialise the SDK [BlipparSDK setKey: your_license_key]; BlipparSDK* sdk = [BlipparSDK sharedInstance]; [sdk addSDKDelegate:self]; [sdk initialise]; // ... other setup code ... return YES; } - (void)onBlipparInitialiseSuccess { // SDK initialized successfully } - (void)onBlipparInitialiseError:(BlipparSDKError *)error { // Handle initialization error NSLog(@"%@",error.description); } - (void)onBlipparShutdown { // SDK shutdown } ``` -------------------------------- ### Import BlipparSDK Framework (Objective-C) Source: https://github.com/blippar/blippar-ar-sdk/blob/master/guides/ios/README.md This Objective-C code demonstrates how to import the BlipparSDK framework into your view controller's header file. This is a prerequisite for using BlipparSDKViewController and BlipparSDKView in your project. ```objective-c #import ``` -------------------------------- ### Derive from BlipparSDKViewController (Swift 3) Source: https://github.com/blippar/blippar-ar-sdk/blob/master/guides/ios/README.md This Swift 3 code snippet illustrates how to declare a custom view controller that inherits from BlipparSDKViewController. This is part of the recommended setup for using the Blippar SDK with Interface Builder. ```swift class BlipparSDKViewController: BlipparSDKViewController ``` -------------------------------- ### Launch Blipp Programmatically (Objective-C, Java) Source: https://github.com/blippar/blippar-ar-sdk/blob/master/guides/blipping.md Launches a Blipp programmatically by creating an `EntityDescriptor` from a blipp address and configuring launch settings. Supports cache invalidation for fetching the latest blipp. Requires `BlippLaunchModeNow` for programmatic launching. ```objectivec NSString* blippAddress = @"abcdefgh"; BlipparSDKEntityDescriptor *descriptor = [BlipparSDKEntityDescriptor entityWithAddress:blippAddress]; BlippLaunchConfig *config = [[BlippLaunchConfig alloc] init]; // Load from cache if present or always ask the server for the latest blipp // Loading from cache is faster but can become out of date // You can potentially do this once a day, or use some similar heuristic BOOL invalidateCache = YES; config.invalidateCache = invalidateCache; // BlippLaunchModeNow is required for programatic launching BlipparSDKBlippContext* context = [[BlipparSDK sharedInstance] launchBlipp:BlippLaunchModeNow descriptor:descriptor config:config]; ``` ```java String blippAddress = "abcdefgh"; EntityDescriptor descriptor = EntityDescriptorFactory.createFromAddress(blippAddress); LaunchConfig config = new LaunchConfig(); // Load from cache if present or always ask the server for the latest blipp // Loading from cache is faster but can become out of date // You can potentially do this once a day, or use some similar heuristic boolean invalidateCache = true; config.setInvalidateCache(invalidateCache); // BlippLaunchMode.Now is required for programatic launching BlippContext context = Blippar.getSDK().launchBlipp(BlippLaunchMode.Now, descriptor, config); ``` -------------------------------- ### Find Android App ID from Play Store URL Source: https://github.com/blippar/blippar-ar-sdk/blob/master/faq.md This example shows how to extract the Android App ID from a Google Play Store URL. The ID is located after 'id=' in the URL and is used to identify the application on the Play Store. ```url https://play.google.com/store/apps/details?id=com.company.appname ``` -------------------------------- ### Initialize Blippar SDK - iOS (Swift) Source: https://context7.com/blippar/blippar-ar-sdk/llms.txt Initializes the Blippar SDK in an iOS application using Swift. This process involves setting the license key and registering a delegate for lifecycle callbacks. An internet connection is required for license key validation during initialization. ```swift import UIKit class AppDelegate: UIResponder, UIApplicationDelegate, BlipparSDKDelegate { var window: UIWindow? func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Set your license key BlipparSDK.setKey("your_license_key_here") // Get SDK instance and register delegate let sdk = BlipparSDK.sharedInstance() sdk.addSDKDelegate(self) sdk.initialise() return true } // Called when SDK initialization succeeds func onBlipparInitialiseSuccess() { print("SDK initialized successfully") } // Called when SDK initialization fails (invalid key, no network, etc.) func onBlipparInitialiseError(_ error: BlipparSDKError) { print("SDK initialization error: (error.description)") } // Called when SDK shuts down func onBlipparShutdown() { print("SDK shutdown complete") } } ``` -------------------------------- ### Enable Location Services in Blippar SDK (iOS) Source: https://github.com/blippar/blippar-ar-sdk/blob/master/guides/location.md Enables location services for the Blippar SDK on iOS. This starts a single-shot location search to determine the device's position. Ensure location permissions are acquired by the app beforehand. ```objectivec [BlipparSDK sharedInstance].locationServicesEnabled = YES; ``` -------------------------------- ### Initialize Blippar SDK - iOS (Objective-C) Source: https://context7.com/blippar/blippar-ar-sdk/llms.txt Sets up the Blippar SDK in an Objective-C iOS application. It includes setting the license key and registering the AppDelegate as a BlipparSDKDelegate to handle initialization success, errors, and shutdown events. ```objectivec // AppDelegate.h #import #import @interface AppDelegate : UIResponder @property (strong, nonatomic) UIWindow *window; @end // AppDelegate.m #import "AppDelegate.h" @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Initialize the SDK with your license key [BlipparSDK setKey:@"your_license_key_here"]; BlipparSDK* sdk = [BlipparSDK sharedInstance]; [sdk addSDKDelegate:self]; [sdk initialise]; return YES; } - (void)onBlipparInitialiseSuccess { NSLog(@"SDK initialized successfully"); } - (void)onBlipparInitialiseError:(BlipparSDKError *)error { NSLog(@"SDK initialization error: %@", error.description); } - (void)onBlipparShutdown { NSLog(@"SDK shutdown complete"); } @end ``` -------------------------------- ### Launch Blipp with Specific Marker ID (Objective-C, Java) Source: https://github.com/blippar/blippar-ar-sdk/blob/master/guides/blipping.md Launches a Blipp programmatically by creating an `EntityDescriptor` using a specific marker ID. This ensures the blipp launches with the intended marker. Ensure the marker ID is valid as alterations can generate new IDs. ```objectivec BlipparSDKEntityDescriptor *descriptor = [BlipparSDKEntityDescriptor entityWithAddress:blippAddress andMarkerID:blippMarkerId]; ``` ```java EntityDescriptor descriptor = EntityDescriptorFactory.createFromParameters(blippAddress, blippMarkerId); ``` -------------------------------- ### Automated Blipp Deployment to Android with fswatch Source: https://github.com/blippar/blippar-ar-sdk/blob/master/guides/debugging/debugging-testing-blipps-sideloading.md This script automates the process of deploying Blipp data to an Android device by watching a local directory for changes and automatically transferring updated files. It relies on `fswatch` to monitor file system events. This significantly speeds up the testing cycle by eliminating manual file transfers after every modification. ```Shell #!/bin/bash # Ensure fswatch is installed: brew install fswatch LOCAL_BLIPP_FOLDER="$1" APP_PACKAGE="$2" if [ -z "$LOCAL_BLIPP_FOLDER" ] || [ -z "$APP_PACKAGE" ]; then echo "Usage: ./startDevAndroid.sh " exit 1 fi echo "Watching folder: $LOCAL_BLIPP_FOLDER for changes..." fswatch -o "$LOCAL_BLIPP_FOLDER" | xargs -n1 -I{} ./deployToAndroid.sh "$APP_PACKAGE/blipparsdk/sideload" "$LOCAL_BLIPP_FOLDER" ``` -------------------------------- ### Enable Debug Test Blipps in Kotlin Source: https://github.com/blippar/blippar-ar-sdk/blob/master/guides/android/README.md This code snippet shows how to enable the debug mode for testing blipps in the Blippar AR SDK using Kotlin. By setting `setDebugTestBlippsEnabled` to true, you can visualize sample markers during development. Remember to disable this feature before releasing your application to the public. ```kotlin Blippar.getSDK().setDebugTestBlippsEnabled(true) ``` -------------------------------- ### Define Blippar SDK Dependency Versions in Gradle Source: https://github.com/blippar/blippar-ar-sdk/blob/master/guides/android/README.md Sets the versions for various libraries used by the Blippar AR SDK. This block should be placed in the top-level `build.gradle` file to ensure consistency across the project. Matching these versions with your app's dependencies is crucial to avoid runtime issues. ```gradle project.ext { buildToolsVersion = '28.0.3' supportLibVersion = '27.1.1' googlePlayServicesVersion = '12.0.1' picassoVersion = '2.5.2' arcoreVersion = '1.4.0' kotlinVersion = '1.2.61' } ``` -------------------------------- ### Android Fragment Integration with Blippar SDK Source: https://context7.com/blippar/blippar-ar-sdk/llms.txt This Java code snippet demonstrates how to integrate the BlipparSDKFragment into an Android Activity. It includes requesting camera permissions, initializing the SDK, setting up listeners for SDK and blipp events, and managing the fragment's lifecycle. Dependencies include the Blippar AR Android SDK. ```java package com.blippar.demo.java; import android.Manifest; import android.os.Bundle; import android.support.v4.app.ActivityCompat; import android.support.v4.content.ContextCompat; import android.support.v7.app.AppCompatActivity; import android.widget.Toast; import com.blippar.ar.android.sdk.*; import com.blippar.ar.android.sdk.internal.*; import org.json.JSONObject; import static android.content.pm.PackageManager.PERMISSION_GRANTED; public class MainActivity extends AppCompatActivity { private static final int CAMERA_REQUEST_CODE = 25; private BlipparSDKFragment blipparSDKFragment; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Register SDK lifecycle listener Blippar.getSDK().addSDKListener(sdkListener); // Register blipp state listener Blippar.getSDK().addBlippStateListener(blippStateListener); // Enable debug logging (optional) Blippar.getSDK().setLogLevel(LogLevel.Debug); // Enable test blipps for development Blippar.getSDK().setDebugTestBlippsEnabled(true); // Request camera permission before adding fragment if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PERMISSION_GRANTED) { ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.CAMERA}, CAMERA_REQUEST_CODE); } else { setupBlipparFragment(); } } private void setupBlipparFragment() { blipparSDKFragment = BlipparSDKFragment.create(); getSupportFragmentManager() .beginTransaction() .replace(R.id.frame_layout, blipparSDKFragment) .commitAllowingStateLoss(); } @Override protected void onDestroy() { super.onDestroy(); Blippar.getSDK().removeSDKListener(sdkListener); Blippar.getSDK().removeBlippStateListener(blippStateListener); } private final BlipparSDK.BlipparSDKListener sdkListener = new BlipparSDK.BlipparSDKListener() { @Override public void onInitialiseSuccess() { // Start marker detection after successful initialization Blippar.getSDK().startDetection(); } @Override public void onInitialiseError(InitialisationError error) { Toast.makeText(MainActivity.this, "SDK Error: " + error, Toast.LENGTH_LONG).show(); } @Override public void onShutdown() { Blippar.getSDK().removeSDKListener(this); } }; private final BlippStateListener blippStateListener = new BlippStateListener() { @Override public void onBlippLoading(BlippContext context) { // Blipp started loading - show UI elements } @Override public void onBlippRunning(BlippContext context, BlippRunningState state) { // Blipp is running - state can be Normal, Peel, or Expired } @Override public void onBlippClosed(BlippContext context) { // Blipp closed - hide UI elements } @Override public boolean onBlippEvent(BlippContext context, String eventName, JSONObject data) { // Handle events sent from blipp to app return false; // Return true if handled } // Additional required overrides... @Override public void onBlippLoadingProgress(BlippContext c, int p) {} @Override public void onBlippLoaded(BlippContext c) {} @Override public void onBlippError(BlippContext c, BlipparSDKBlippErrorType e) {} @Override public void onBlippClosing(BlippContext c) {} @Override public void onBlippWaitingForTrackingLock(BlippContext c) {} }; } ``` -------------------------------- ### Verify Blipp Files on Android Device using ADB Source: https://github.com/blippar/blippar-ar-sdk/blob/master/guides/debugging/debugging-testing-blipps-sideloading.md This command sequence verifies that Blipp files have been successfully copied to the Android device's sideload directory. It uses `adb shell` to navigate to the expected directory and `ls` to list its contents. Successful verification confirms that the sideloading mechanism is ready for testing. ```Shell adb shell cd /sdcard/Android/data//blipparsdk ls ``` -------------------------------- ### Control Marker and Barcode Detection Source: https://context7.com/blippar/blippar-ar-sdk/llms.txt Manages the marker and barcode detection process using the Blippar SDK. This includes starting and stopping detection for specific types, handling detection results, and responding to various failure reasons like no connection or poor lighting conditions. It requires the Blippar SDK library. ```java // Android - Control detection BlipparSDK sdk = Blippar.getSDK(); // Start default detection (markers, barcodes, visual search) sdk.startDetection(); // Start detection for specific types only sdk.startDetection(DetectionType.Markers); // Markers only sdk.startDetection(DetectionType.Barcodes); // Barcodes only // Stop detection sdk.stopDetection(); // Handle detection results Blippar.getSDK().addDetectionListener(new DetectionListener() { @Override public void onDetectionResults(List entities) { for (EntityDescriptor entity : entities) { if (entity.getType() == EntityType.Blipp) { // Marker detected - blipp will auto-launch Log.d("Detection", "Blipp detected: " + entity.getAddress()); } else if (entity.getType() == EntityType.Barcode) { // Barcode detected Log.d("Detection", "Barcode: " + entity.getBarcodeValue()); } } } @Override public void onDetectionNoResults(DetectionFailureReason reason) { switch (reason) { case NoConnection: showNoInternetMessage(); break; case TooDark: showBrightenMessage(); break; case MovingTooFast: showSlowDownMessage(); break; } } }); ```