locked
Project structure for push enabled apps? RRS feed

  • Question

  • Hi,

    I'am currently developing a Windows Store app. I want to push messages as a raw notification to my app.

    My solution has following structure:

    • Solution
    • aPager (Windows 8.1)
    • aPager Windows Phone (Windows Phone 8.1)
    • Classes (Portable)
    • PushNotificationsHelper (Windows 8.1)

    All necessary XAML files are located in the project called "aPager". All utility classes are located in project "Classes". "aPager" has a reference to "Classes", "SQLite" and "PushNotificationsHelper".

    My background tasks (class "RawNotifications") are located in "PushNotificationsHelper". After receiving a raw notification, I want to add an item to my local SQLite database and therefore I want to access a class which is located in my "aPager" project.

    The problem now is, that I cannot add "aPager" as a reference to "PushNotificationsHelper", because otherwise I would create a dependency circle (aPager > PushNotificationsHelper > aPager).

    My question is:

    Is it really necessary to put my background tasks into a different project? Why cant I add them directly to my main project ("aPager")? Or is there another way to access my main project (reflection?)?

    I tried to move the background tasks into the main project, but after that, they couldnt be executed:

    "...app is not registered for contract "Windows.BackgroundTasks" or not installed".

    Thanks for your help and greetings from Germany

    Simon

    Wednesday, June 4, 2014 9:00 PM

Answers

  • Yes, the background task needs to be in a separate project. It compiles into a separate assembly.

    You can share code between the projects either by putting the shared code in a (third) library project which the other two projects reference or by linking the same file into both projects.

    --Rob

    • Marked as answer by Anne Jing Thursday, June 12, 2014 6:20 AM
    Thursday, June 5, 2014 1:44 AM
    Moderator